import com.sun.org.apache.xpath.internal.WhitespaceStrippingElementMatcher;

import java.util.Arrays;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        /*Scanner input = new Scanner(System.in);
        //自幂数
        int n = 99999;
        int tep = 0;
        int count = 0;
        int i = 0;
        double sum = 0;
        for ( i = 1; i <= n; i++) {
            count = 0;
            tep = i;
            while (tep != 0) {
                count++;
                tep /= 10;
            }
            tep = i;
            sum = 0;
            while (tep != 0) {
                sum += Math.pow(tep % 10, count);
                tep /= 10;
            }
            if (sum == i) {
                System.out.println(i + "是自幂数");
            }
        }
        //判断二进制位数中1的个数
        int num = input.nextInt();
        int count = 0;
        for (int i = 0; i <= 31 ; i++) {
            if (((num>>>i)& 1) != 0) {
                count++;
            }
        }
        while(num != 0) {
            count++;
            num = num & (num -1);
        }
        System.out.println(count);
        //10000000000000000000000000000001   -1原码
        //11111111111111111111111111111110   -1反码
        //11111111111111111111111111111111   -1补码

        //10000000000000000000000000000010   -2原码
        //11111111111111111111111111111101   -2反码
        //11111111111111111111111111111110   -2补码


        //求二进制位数中的奇数位和偶数位
        int num = input.nextInt();
        for (int i = 31; i >= 0; i-=2) {
            System.out.print(((num>>i) & 1 )+ " ");
        }
        System.out.println();
        for (int i = 30; i >= 0; i-=2) {
            System.out.print(((num>>i) & 1 )+ " ");
        }

        //拷贝方法
        int[] arr = {1,2,3,4,5,6,7};
        int[] arr2 = Arrays.copyOf(arr,arr.length);
        System.out.println(Arrays.toString(arr2));

        //填充方法
        int[] arr3 = new int[10];
        Arrays.fill(arr3,0,arr3.length,-1);//[0,arr3.length)
        System.out.println(Arrays.toString(arr3));
        //记录时间
        long start = System.currentTimeMillis();
        int a = 3;
        long end  = System.currentTimeMillis();
        System.out.println(end - start);
        //多数元素的求法
        //[2,3,4,3,2,2,2,5]   -----> 2
        int[] arr = new int[]{1,2,3,4,2,2,2,2,2};
        int i = 1;
        int count = 1;
        int max = arr[0];
        while (i < arr.length) {
            if (arr[i] == max) {
                count++;
            } else if (arr[i] != max) {
                count--;
            }
            if(count == 0) {
                max = arr[i];
                count++;
            }
            i++;
        }
        System.out.println(max + "是多数元素");*/
    }
}
